package com.example.webdriveddd.dto;

import lombok.Data;

import java.util.Objects;

@Data
public class UserDTO {
    private int id;
    private String username;
    private String password;

    public boolean equals(Object other){
        if(other instanceof UserDTO otherUser){
            if(this.id == otherUser.id){
                return true;
            }
            if (this.username.equals(otherUser.username)){
                return true;
            }
            return false;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(username);
    }
}
